#include <stdio.h>

int i;

int main()
{
    int a, y, z;
    printf("Input Full a,Empty b,c,Get i:");
    scanf("%d%d%d%d", &a, &y, &z, &i);
    getti(a, y, z);
    getti(a, z, y);

    return 0;
}
getti(a, y, z) 
    int a, y, z;
{
    int b = 0, c = 0;
    printf("a%d b%d c%d\n%4d%4d%4d\n", a, y, z, a, b, c);
    while (a != i || b != i && c != i)
    {
        if (!b)
        {
            a -= y;
            b = y;
        }
        else if (c == z)
        {
            a += z;
            c = 0;
        }
        else if (b > z - c)
        {
            b -= (z - c);
            c = z;
        }
        else
        {
            c += b;
            b = 0;
        }
        printf("%4d%4d%4d\n", a, b, c);
    }
}
//熊贤豪